java gradletomcatplugin:log4j:WARN找不到记录器的附加程序
我已经配置了gradle tomcat插件,但是当我运行tomcatRun
任务时,log4j会被激活。未找到src/main/resources
文件夹中的xml配置文件:
log4j:WARN No appenders could be found for logger
...
在记录器的线程中,我可以使用
Thread.currentThread().getContextClassLoader().getResource("log4j.xml"); // project_root/build/resources/main/log4j.xml
这在理论上就是log4j加载文件的方式
如果我在Tomcat安装中部署war,我就不会有这个问题
运行任务的完整日志:
12:03:16: Executing task 'tomcatRun'...
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :tomcatRun
Started Tomcat Server
The Server is running at http://localhost:8080/project_context
(this comes from a System.out.println() before trying to use the logger)
File : /C:/Users/MyUsername/IdeaProjects/project_name/build/resources/main/log4j.xml
log4j:WARN No appenders could be found for logger (Classname).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
共 (0) 个答案